# -*- coding: utf-8 -*-
"""
author:码同学 极光
date:2024/9/21
desc: 
sample:
控制台模拟用户登录 用户名 root 密码root ，只能重试3次
"""

counter = 0
while counter < 3:
    user_name = input('用户名:')
    pwd = input('密码:')
    if user_name == 'root' and pwd == 'root':
        print('登录成功')
        break
    else:
        counter = counter + 1
        if counter==3:
            print('机会用完了')
            break
        print(f'登录失败，还有{3 - counter}次机会')
